const express = require('express');
const router = express.Router();
const { Category } = require('../../models');
const { success, failure } = require('../../utils/responses');
router.get('/', async (req, res) => {
  try {
    const categories = await Category.findAll({
      order: [
        ['rank', 'asc'],
        ['id', 'desc'],
      ],
    });
    success({ res, data: categories });
  } catch (error) {
    failure({ res, error });
  }
});
module.exports = router;
